<div class="container">
    <div class="row">
        <div class="col-sm-6">
            <h2>
                <?php 
                    echo "Dodaj konto";
                    ?>
            </h2>

            
            <?php $form = $this->beginWidget('CActiveForm', array('id' => 'register-account-form')); ?>
            <div class="form-group">
                <?php echo $form->labelEx($model, 'no_account'); ?>
                <?php 
                    $form->widget('CMaskedTextField',array(
                        'model'=>$model,
                        'id'=>'AccountForm_no_account',
                        'name'=>'AccountForm[no_account]',
                        'mask'=>'99 9999 9999 9999 9999 9999 9999',
                        'placeholder'=>' ',
                        'htmlOptions'=>array(
                            'class' => 'form-control',
                        ),
                    ));
//                echo $form->textField($model, 'no_account', array('class' => 'form-control')) 
                        ?>
                <?php echo $form->error($model, 'no_account') ?>
            </div>
            <div class="form-group">
                <?php echo $form->labelEx($model, 'account_type_id'); ?>
                <?php 
                    $atl = CHtml::listData(AccountForm::accountTypeList(),'id_rodzaj_konta','nazwa');
                    echo $form->dropDownList($model, 'account_type_id', $atl, array('class' => 'form-control')) ?>
                <?php echo $form->error($model, 'account_type_id') ?>
            </div>
                <div class="form-group">
                    <?php echo $form->labelEx($model, 'currency_id'); ?>
                    <?php 
                    $cl = CHtml::listData(AccountForm::currencyList(),'id_waluty','nazwa');
                    echo $form->dropDownList($model, 'currency_id', $cl, array('class' => 'form-control')) ?>
                <?php echo $form->error($model, 'currency_id') ?>
                </div>
                <div class="form-group">
                    <?php echo $form->labelEx($model, 'date_add'); ?>
                    <?php // echo $form->textField($model, 'date_add', array('class' => 'form-control')) ?>
                    <?php
                        $form->widget('zii.widgets.jui.CJuiDatePicker',array(
                            'model'=>$model,
                            'id'=>'AccountForm_date_add',
                            'name'=>'AccountForm[date_add]',
//                            'attribute'=>'date_add',
//                            'name'=>'date_add',
                            // additional javascript options for the date picker plugin
                            'options'=>array(
                                'showAnim'=>'slide',
                                'dateFormat' => 'yy-mm-dd',
                            ),
                            'htmlOptions'=>array(
                                'class' => 'form-control',
                            ),
                        ));
//                        echo $form->textField($model, 'date_add', array('class' => 'form-control')) 
                    ?>
                    <?php echo $form->error($model, 'date_add') ?>
                </div>
            <div class="form-group">
                <?php echo $form->labelEx($model, 'max_debet'); ?>
                <?php 
                    $form->widget('CMaskedTextField',array(
                        'model'=>$model,
                        'id'=>'AccountForm_max_debet',
                        'name'=>'AccountForm[max_debet]',
//                        'attribute'=>'max_debet',
//                        'name'=>'max_debet',
                        'mask'=>'99 999.99',
                        'placeholder'=>' ',
                        'htmlOptions'=>array(
                            'class' => 'form-control',
                        ),
                    ));
                
//                echo $form->textField($model, 'max_debet', array('class' => 'form-control' )) 
                    ?>
                <?php echo $form->error($model, 'max_debet') ?>
            </div>
            <div class="form-group">
                <?php echo $form->labelEx($model, 'user_id'); ?>
                <?php 
                    $ul = CHtml::listData(AccountForm::usersList(),'id_uzytkownika', 'name');
                    echo $form->dropDownList($model, 'user_id', $ul, array('class' => 'form-control')) ?>
                <?php echo $form->error($model, 'user_id') ?>
            </div>

            <?php 
//            if(isset($_GET['id'])){
//                echo CHtml::submitButton('Edytuj pracownika', array('class' => 'btn btn-success'));
//            }else{
                echo CHtml::submitButton('Dodaj konto', array('class' => 'btn btn-success'));
//            }
            ?>
            <?php $this->endWidget(); ?>
        </div>
    </div>
</div>

